package com.tx.admin.security.auth;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
import org.springframework.stereotype.Component;

@Component
public class UserCredentialsMatcher extends SimpleCredentialsMatcher{

	@Override
	public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
		// TODO Auto-generated method stub
		if( super.doCredentialsMatch(token, info)) {
			return true;
		}else {
		       Object tokenCredentials = getCredentials(token);
		        Object accountCredentials = getCredentials(info);
			throw new AuthenticationException ("密码错误:"+tokenCredentials+"=============="+accountCredentials);
		}
	}

	
}
